#ifndef XBONE
#define XBONE
#include "../XModEngine/XObject.h"
#include "../XModEngine//Matrix.h"
#include "../XModEngine/XVertexBuffer.h"
#include "../XModEngine/XRender.h"
class XBone : public XObject{
protected:
	Matrix4 m_origin_matrix,m_trans_matrix;
	bool m_dirty;
	XVertexBuffer* m_skel_buffer;

	//?Vector3 m_size; Scale maybe useless
public:
	struct Weight{
		int pointId;
		float weight;
	};
	XBone* m_parent;
	string m_name;
	//?int m_parent_index; We create the relation to parent and also knew who is the parent to this bone
	Quaternion m_rotation;
	Vector3 m_offest;
	Vector3 m_abs_offest;
	Quaternion m_abs_rotation;
	vector<Weight> m_weights;
	XBone();
	~XBone();
	void SetOffest(Vector3);
	void SetRotation(Quaternion);
	Matrix4 GetTransformMatrix();
	void CalcOriginTransformMatrix();
	void CalcFinalTransformMatrix();
	void UpdateBone();
	void RenderBone();
};
#endif